<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="kubernetes,ops" />
	<meta name="description" content="High Available Usage Deployment" />
	<!-- 网页标签标题 -->
	<title>High Available Usage Deployment</title>
  <link rel="shortcut icon" href="/img/seata_logo_small.jpeg"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="//img.alicdn.com/tfs/TB1gqL1w4D1gK0jSZFyXXciOVXa-1497-401.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="https://img.alicdn.com/tfs/TB14eEmw7P2gK0jSZPxXXacQpXa-38-32.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html" target="_self">HOME</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/en-us/docs/overview/what-is-seata.html" target="_self">DOCS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/docs/developers/developers_dev.html" target="_self">DEVELOPERS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog/index.html" target="_self">BLOG</a></li><li class="menu-item menu-item-normal"><a href="/en-us/community/index.html" target="_self">COMMUNITY</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog/download.html" target="_self">DOWNLOAD</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="https://img.alicdn.com/tfs/TB1cm8nJwDqK1RjSZSyXXaxEVXa-160-160.png" class="front-img"/><span>Documentation</span><img src="https://img.alicdn.com/tfs/TB1cm8nJwDqK1RjSZSyXXaxEVXa-160-160.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Overview</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/what-is-seata.html" target="_self">What is Seata?</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/terminology.html" target="_self">Terminology</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/faq.html" target="_self">FAQ</a></li></ul></li><li class="menu-item menu-item-level-1"><span>User Doc</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/quickstart.html" target="_self">Quick Start</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/api.html" target="_self">API Guide</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/microservice.html" target="_self">Microservices Framework Supports</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Developer Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Transaction Mode<img style="transform:rotate(-90deg)" class="menu-toggle" src="https://img.alicdn.com/tfs/TB15.Ilw2b2gK0jSZK9XXaEgFXa-26-16.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/at-mode.html" target="_self">Seata AT mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/tcc-mode.html" target="_self">Seata TCC mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/saga-mode.html" target="_self">Seata Saga mode</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/dev/seata-mertics.html" target="_self">Metrics design</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Ops Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/ops/multi-configuration-isolation.html" target="_self">Configuration Isolation</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Deploy<img style="transform:rotate(-90deg)" class="menu-toggle" src="https://img.alicdn.com/tfs/TB15.Ilw2b2gK0jSZK9XXaEgFXa-26-16.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-server.html" target="_self">Deploy Directly</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-docker.html" target="_self">Deploy by Docker</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-kubernetes.html" target="_self">Deploy by Kubernetes</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-helm.html" target="_self">Deploy by Helm</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-ha.html" target="_self">Deploy in High Available Usage</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>High Available Usage Deployment</h1>
<blockquote>
<p>High available usage deployment of Seata depends on registry center, configuration center and database.</p>
</blockquote>
<h2>Seata-Server</h2>
<p>The Seata-Server need registry center, and save transaction data into database, for example, use Nacos</p>
<ul>
<li>Modify configuration in <code>registry.conf</code></li>
</ul>
<pre><code>registry {
  type = &quot;nacos&quot;

  nacos {
    application = &quot;seata-server&quot;
    serverAddr = &quot;192.168.199.2&quot;
    namespace = &quot;&quot;
    cluster = &quot;default&quot;
    username = &quot;&quot;
    password = &quot;&quot;
  }
}

config {
  type = &quot;nacos&quot;
  
  nacos {
    serverAddr = &quot;192.168.199.2&quot;
    namespace = &quot;&quot;
    group = &quot;SEATA_GROUP&quot;
    username = &quot;&quot;
    password = &quot;&quot;
  }
}
</code></pre>
<ul>
<li>Modify configuration in configuration center</li>
</ul>
<pre><code>service.vgroupMapping.my_test_tx_group=default
store.mode=db
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://192.168.199.2:30060/seata?useUnicode=true
store.db.user=root
store.db.password=123456
</code></pre>
<ul>
<li>Create table <code>global_table</code>, <code>branch_table</code>, <code>lock_table</code> in database</li>
</ul>
<p>Please reference script on <a href="https://github.com/seata/seata/tree/develop/script/server/db">/script/server/db/</a></p>
<p>Now, startup multiple seata-server, and then the server is support high available usage.</p>
<hr>
<p>For example, using Kubernetes deploy, the configuration file like:</p>
<pre><code class="language-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">  namespace:</span> <span class="hljs-string">default</span>
<span class="hljs-attr">  labels:</span>
    <span class="hljs-string">app.kubernetes.io/name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">spec:</span>
<span class="hljs-attr">  type:</span> <span class="hljs-string">ClusterIP</span>
<span class="hljs-attr">  ports:</span>
<span class="hljs-attr">    - port:</span> <span class="hljs-number">8091</span>
<span class="hljs-attr">      protocol:</span> <span class="hljs-string">TCP</span>
<span class="hljs-attr">      name:</span> <span class="hljs-string">http</span>
<span class="hljs-attr">  selector:</span>
    <span class="hljs-string">app.kubernetes.io/name:</span> <span class="hljs-string">seata-ha-server</span>

<span class="hljs-meta">---</span>

<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">  namespace:</span> <span class="hljs-string">default</span>
<span class="hljs-attr">  labels:</span>
    <span class="hljs-string">app.kubernetes.io/name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">spec:</span>
<span class="hljs-attr">  replicas:</span> <span class="hljs-number">3</span>
<span class="hljs-attr">  selector:</span>
<span class="hljs-attr">    matchLabels:</span>
      <span class="hljs-string">app.kubernetes.io/name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">  template:</span>
<span class="hljs-attr">    metadata:</span>
<span class="hljs-attr">      labels:</span>
        <span class="hljs-string">app.kubernetes.io/name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">    spec:</span>
<span class="hljs-attr">      containers:</span>
<span class="hljs-attr">        - name:</span> <span class="hljs-string">seata-ha-server</span>
<span class="hljs-attr">          image:</span> <span class="hljs-string">docker.io/seataio/seata-server:latest</span>
<span class="hljs-attr">          imagePullPolicy:</span> <span class="hljs-string">IfNotPresent</span>
<span class="hljs-attr">          env:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">SEATA_CONFIG_NAME</span>
<span class="hljs-attr">              value:</span> <span class="hljs-attr">file:/root/seata-config/registry</span>
<span class="hljs-attr">          ports:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">http</span>
<span class="hljs-attr">              containerPort:</span> <span class="hljs-number">8091</span>
<span class="hljs-attr">              protocol:</span> <span class="hljs-string">TCP</span>
<span class="hljs-attr">          volumeMounts:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">seata-config</span>
<span class="hljs-attr">              mountPath:</span> <span class="hljs-string">/root/seata-config</span>
<span class="hljs-attr">      volumes:</span>
<span class="hljs-attr">        - name:</span> <span class="hljs-string">seata-config</span>
<span class="hljs-attr">          configMap:</span>
<span class="hljs-attr">            name:</span> <span class="hljs-string">seata-ha-server-config</span>


<span class="hljs-meta">---</span>
<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">ConfigMap</span>
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> <span class="hljs-string">seata-ha-server-config</span>
<span class="hljs-attr">data:</span>
  <span class="hljs-string">registry.conf:</span> <span class="hljs-string">|
    registry {
        type = "nacos"
        nacos {
          application = "seata-server"
          serverAddr = "192.168.199.2"
        }
    }
    config {
      type = "nacos"
      nacos {
        serverAddr = "192.168.199.2"
        group = "SEATA_GROUP"
      }
    }
</span></code></pre>
<p>You can reference <a href="https://seata.io/zh-cn/blog/seata-ha-practice.html">seata-ha-deploy-practice</a> for more detail about practice of HA deploy.</p>
</div></section><footer class="footer-container"><div class="footer-body"><img src="//img.alicdn.com/tfs/TB1dGrSwVT7gK0jSZFpXXaTkpXa-4802-1285.png"/><p class="docsite-power">website powered by docsite</p><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>Seata is an Alibaba open source distributed transaction solution that delivers high performance and easy to use distributed transaction services under a microservices architecture.</p></div><div class="col col-6"><dl><dt>Documentation</dt><dd><a href="/en-us/docs/overview/what-is-seata.html" target="_self">What is Seata?</a></dd><dd><a href="/en-us/docs/user/quickstart.html" target="_self">Quick Start</a></dd><dd><a href="https://github.com/seata/seata.github.io/issues/new" target="_self">Report a doc issue</a></dd><dd><a href="https://github.com/seata/seata.github.io" target="_self">Edit This Page on GitHub</a></dd></dl></div><div class="col col-6"><dl><dt>Resources</dt><dd><a href="/en-us/blog/index.html" target="_self">Blog</a></dd><dd><a href="/en-us/community/index.html" target="_self">Community</a></dd></dl></div></div><div class="copyright"><span>Copyright © 2019 Seata</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
	<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?104e73ef0c18b416b27abb23757ed8ee";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
</body>
</html>
